package com.situ.team5.kzq.recruit.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.situ.team5.kzq.recruit.service.EngageResumeService;
import com.situ.team5.kzq.recruit.service.LyGlService;
import com.situ.team5.kzq.recruit.service.MsService;
import com.situ.team5.pojo.EngageResume;
import com.situ.team5.util.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Controller
public class LyGlController extends BaseController {
    @Autowired
    LyGlService lyser;
    @Autowired
    MsService mser;
    @Autowired
    EngageResumeService eser;

    @RequestMapping("register_list")
    public String register_list(Map map,
                                @RequestParam(defaultValue = "1",required = false) Integer startPage,
                                @RequestParam(defaultValue = "2",required = false) Integer PageSize){
        PageHelper.startPage(startPage, PageSize ); //使用分页插件
        List<Map> ler= lyser.register_listSelectAll();
        PageInfo pageInfo=new PageInfo(ler, 2); //保存分页信息
        map.put("pageInfo", pageInfo);
        map.put("ler", ler);
        return"/page/recruit/employ/register_list.html";
    }
    //点击申请超链接
    @RequestMapping("register_kzq_sq")
    public String register_sp(int id,Map map){
        Map qqmap = mser.yxjlSelectAllOne2(id);
        map.put("pp", qqmap);
        return"/page/recruit/employ/register.html";
    }


    @RequestMapping("register_kzq_sq2")
    public String register_sp2(EngageResume e,int ein_id){
        //修改简历状态，修改 pass_checkComment
        eser.update_pass_checkComment(e);
        //修改面试表简历状态
        mser.update_engage_interview_check_status(e.getJl_status(),ein_id);
        return"redirect:register_list";
    }
//录用审批
    @RequestMapping("check_list")
    public String check_list(Map map,  @RequestParam(defaultValue = "1",required = false) Integer startPage,
                             @RequestParam(defaultValue = "2",required = false) Integer PageSize){
        PageHelper.startPage(startPage, PageSize ); //使用分页插件
        int id=7;
        List<Map> rls= lyser.register_listSelectAll_sp(id);
        PageInfo pageInfo=new PageInfo(rls, 2); //保存分页信息
        map.put("pageInfo", pageInfo);
        map.put("ler", rls);
        return"/page/recruit/employ/check_list.html";
    }
    //审批
    @RequestMapping("check_kzq_sp")
    public String check_kzq_sp(int id,Map map){
        Map qqmap = mser.yxjlSelectAllOne2(id);
        map.put("pp", qqmap);
        return"/page/recruit/employ/check.html";
    }

    //审批功能
    @RequestMapping("check_kzq_sp2")
    public String check_kzq_sp2(EngageResume e,int ein_id){
        //修改简历状态，修改 pass_passComment
        eser.update_pass_passComment(e);
        //修改面试表简历状态
        mser.update_engage_interview_check_status(e.getJl_status(),ein_id);
        return"redirect:check_list";
    }

    @RequestMapping("listkzq")
    public String listkzq(Map map,
            @RequestParam(defaultValue = "1",required = false) Integer startPage,
            @RequestParam(defaultValue = "2",required = false) Integer PageSize
    ){
        PageHelper.startPage(startPage, PageSize ); //使用分页插件
        int id=8;
        List<Map> rls= lyser.register_listSelectAll_sp(id);
        PageInfo pageInfo=new PageInfo(rls, 2); //保存分页信息
        map.put("pageInfo", pageInfo);
        map.put("ler", rls);

        return"/page/recruit/employ/list.html";
    }


    @RequestMapping("listkzq_details")
    public String listkzq_details(int id,Map map){
        Map qqmap = mser.yxjlSelectAllOne2(id);
        map.put("pp", qqmap);
        return"/page/recruit/employ/details.html";
    }

}
